/**
 * 
 * @author: xj.huang
 * @date: 2021/08/02 09:53:00
 */
export default class Event {
    /**点击事件 */
    public static onClick(Event:Laya.Node,caller: any, listener: Function, args?: any[]){
        Event.on(Laya.Event.CLICK,caller, listener, args)
        Event.on(Laya.Event.MOUSE_DOWN,this,this.onMouseDown,[Event['scaleX'],Event['scaleY']])
        Event.on(Laya.Event.MOUSE_UP,this,this.onMouseUP,[Event['scaleX'],Event['scaleY']])
        Event.on(Laya.Event.MOUSE_OUT,this,this.onMouseUP,[Event['scaleX'],Event['scaleY']])
    }
    /**销毁点击事件 */
    public static offClick(Event:Laya.Node,caller: any, listener: Function,){
        Event.off(Laya.Event.CLICK,caller, listener)
        Event.off(Laya.Event.MOUSE_DOWN,this,this.onMouseDown)
        Event.off(Laya.Event.MOUSE_DOWN,this,this.onMouseUP)
    }
    public static onMouseDown(sX,sY,e:Laya.Event){
        Laya.Tween.to(e.target,{scaleX:sX*0.9,scaleY:sX*0.9},80)
    }
    public static onMouseUP(sX,sY,e:Laya.Event){
        Laya.Tween.to(e.target,{scaleX:sX,scaleY:sX},80)
    }
    /**触摸事件-Down */
    public static onMouse(Event:Laya.Node,caller: any, listener: Function, args?: any[]){
        Event.on(Laya.Event.MOUSE_DOWN,caller, listener, args)
        Event.on(Laya.Event.MOUSE_DOWN,this,this.onMouseDown,[Event['scaleX'],Event['scaleY']])
        Event.on(Laya.Event.MOUSE_UP,this,this.onMouseUP,[Event['scaleX'],Event['scaleY']])
        Event.on(Laya.Event.MOUSE_OUT,this,this.onMouseUP,[Event['scaleX'],Event['scaleY']])
    }
}